﻿using UnityEngine;
using System.Collections;

public class UIManager : MonoBehaviour {

	public UIManagerData uiManagerData;
	public DialogueManager dialogueManager;
	public MenuManager_exo  menuManager;
	public MusicManager musicManager;
	public ScreenshotCapturer screenshotCapturer;
	public LoadManager loadManager;
	public SaveManager saveManager;

	void Awake()
	{
		uiManagerData = GameObject.Find("DataManager").GetComponent<UIManagerData>();
		menuManager = GameObject.Find ("MenuManager").GetComponent<MenuManager_exo> ();
		musicManager = GameObject.Find("MenuManager").GetComponent<MusicManager>();
		screenshotCapturer = GameObject.Find("SaveLoadManager").GetComponent<ScreenshotCapturer>();
		loadManager = GameObject.Find("SaveLoadManager").GetComponent<LoadManager>();
		saveManager = GameObject.Find("SaveLoadManager").GetComponent<SaveManager>();
	}

	public void OnAudio()
	{
		musicManager.MuteAudio();
	}

	public void OnSkip()
	{
		dialogueManager.dm.setSkip (true);
	}

	public void OnAuto()
	{
		dialogueManager.dm.setAuto (true);
	}

	public void OnQLoad()
	{
		FileLoader fl = new FileLoader();
		fl.QuickLoad();
	}

	public void OnQSave()
	{
		FileSaver fs = new FileSaver();
		fs.quickSave();
	}

	public void OnSettings()
	{
		menuManager.OpenSettingsMenu ();
	}

	public void OnQuit()
	{
		print ("OnQuit");
	}

	public void OnSave()
	{
		menuManager.OpenSaveMenu();
	}

	public void OnLoad()
	{
		menuManager.OpenLoadMenu();
	}

	void OnLevelWasLoaded()
	{
		uiManagerData = GameObject.Find("DataManager").GetComponent<UIManagerData>();
		menuManager = GameObject.Find ("MenuManager").GetComponent<MenuManager_exo> ();
		musicManager = GameObject.Find("MenuManager").GetComponent<MusicManager>();
		screenshotCapturer = GameObject.Find("SaveLoadManager").GetComponent<ScreenshotCapturer>();
		loadManager = GameObject.Find("SaveLoadManager").GetComponent<LoadManager>();
		saveManager = GameObject.Find("SaveLoadManager").GetComponent<SaveManager>();
	}
}
